package input;

import java.awt.event.*;
import java.awt.geom.Point2D;

import model.Model;

import control.Controller;

public class Mouse implements MouseListener, MouseMotionListener
{
	private Point2D latestMousePos;
	private Model model;
	
	public Mouse(Model model) 
	{
		this.model = model;
		latestMousePos = new Point2D.Double();
	}

	public Point2D getLatestMousePos()
	{
		return latestMousePos;
	}

	@Override
	public void mouseDragged(MouseEvent arg0) 
	{
		
	}

	@Override
	public void mouseMoved(MouseEvent arg0) 
	{
		model.setLatestMousePos(arg0.getPoint());
	}

	@Override
	public void mouseClicked(MouseEvent e) 
	{
		double dWorldX = e.getPoint().x - model.getTranslateX();
		double dWorldY = e.getPoint().y - model.getTranslateY();
		model.getWorld().mouseClick(new Point2D.Double(dWorldX, dWorldY));
	}

	@Override
	public void mouseEntered(MouseEvent e) 
	{
		
	}

	@Override
	public void mouseExited(MouseEvent e) 
	{
		
	}

	@Override
	public void mousePressed(MouseEvent e) 
	{
		
	}

	@Override
	public void mouseReleased(MouseEvent e) 
	{
		
	}

}
